package com.uuah.server.component.model.seda;

import com.uuah.config.PoolingProfile;
import com.uuah.config.QueueProfile;
import com.uuah.exception.lifecycle.InitialisationException;
import com.uuah.server.component.model.AbstractModel;

/**
 * A uuah service service model that uses Seda principals to achieve high
 * throughput by Quing events for compoonents and processing them concurrently.
 *
 *
 * @author <a href="jonny_quan@hotmail.com">jonny</a>
 * @date 2008 2008-10-11 02:31:44
 * @version 1.0.0
 */
public class SedaModel extends AbstractModel {
	private int queueTimeout;

	protected PoolingProfile poolingProfile;

	protected QueueProfile queueProfile;

	public String getType() {
		return "seda";
	}

	public void initialise() throws InitialisationException {
		queueTimeout = uuahContext.getConfiguration()
				.getDefaultSynchronousEventTimeout();
		if (queueProfile == null) {
			queueProfile = new QueueProfile();
		}
		if (poolingProfile == null) {
			poolingProfile = new PoolingProfile();
		}
		super.initialise();
	}

	public int getQueueTimeout() {
		return queueTimeout;
	}

	public void setQueueTimeout(int queueTimeout) {
		this.queueTimeout = queueTimeout;
	}

	public PoolingProfile getPoolingProfile() {
		return poolingProfile;
	}

	public void setPoolingProfile(PoolingProfile poolingProfile) {
		this.poolingProfile = poolingProfile;
	}

	public QueueProfile getQueueProfile() {
		return queueProfile;
	}

	public void setQueueProfile(QueueProfile queueProfile) {
		this.queueProfile = queueProfile;
	}
}
